package com.yanwq.sayhi.common.tool;

import android.content.Context;
import android.view.View;
import android.view.inputmethod.InputMethodManager;

/**
 * 作者：yanweiqiang。
 * 日期：2016/2/25 13:10。
 */
public class InputMethodTool {

    public static void showKeyboard(View view) {
        InputMethodManager methodManager = (InputMethodManager) view.getContext().getSystemService(
                Context.INPUT_METHOD_SERVICE);
        methodManager.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
    }

    public static void hideKeyboard(View view) {
        InputMethodManager methodManager = (InputMethodManager) view.getContext().getSystemService(
                Context.INPUT_METHOD_SERVICE);
        methodManager.hideSoftInputFromInputMethod(view.getWindowToken(),
                InputMethodManager.HIDE_IMPLICIT_ONLY);
    }
}
